function addFile(obj){
    var files = $(obj).parent().find("input[type='file']");
    var filesName = $(obj).parent().find("input[type='text']");
    for (var i = 0; i < files.length; i++) {
        if ($(files[i]).val()=="") {
            alert("请选择上传的图片!")
            return false;
        }
    }
    for (var i = 0; i < filesName.length; i++) {
        if ($(filesName[i]).val()=="") {
            alert("请输入图片名称!")
            return false;
        }
    }
    $(obj).parent().append('   <div class="fileinput fileinput-new" data-provides="fileinput"><input type="hidden">'
        +'<div class="fileinput-new thumbnail" style="width: 128px; height: 120px;" data-trigger="fileinput">'
        +'<img src="http://placehold.it/200x150" alt="...">'
        +'</div>'
        +'<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 128px; max-height: 120px; line-height: 6px;"></div>'
        +'<div>'
        +'<span class="btn-white btn-file">'
        +'<span class="btn fileinput-new">上传图片</span>'
        +'<input style="width: 120px;" class="fileinput-exists" name="imagename" type="text" placeholder="输入图片名称" />'
        +'<span class="btn fileinput-exists">修改</span><input type="file" name="image" accept="image/*"></span>  '
        +'<a href="#" class="btn btn-orange fileinput-exists" data-dismiss="fileinput"> 删除</a>'
        +'</div></div>')
}
function urlAdd(obj){
    var files = $(obj).parent().find("input[type='text']");
    var len = files.length;
    for (var i = 0; i < len; i++) {
        if ($(files[i]).val()=="") {
            alert("请输入网址链接!");
            return false;
        }
    }
    var textarea_name = "desps" + len;
    $(obj).parent().append('<p><input class="delFileBtn" onclick="delFile(this)" type="button" value="删除"><input name="news_link"  class="clearfix" type="text"></p>')
}
function delFile(obj){
	$(obj).parent().remove();
}